package com.zzy;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class HelloServlet
 */
@WebServlet("/HelloServlet")
public class HelloServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		List<Person>  plist=new ArrayList<Person>();
		
		for(int i=0;i<10;i++){
			Person  person=new Person();
			person.setName("张三");
			person.setPassword("123");
			
			Person  person2=new Person();
			person2.setName("李四");
			person2.setPassword("321");

			plist.add(person);
			plist.add(person2);
		}
		
		request.getSession().setAttribute("hello", "你好吗");
		
		String plistStr=SerializeUtil.fastJsonSerialize(plist);
		request.getSession().setAttribute("plist", plistStr);
		
		
		//jquery.page
		//request.getRequestDispatcher("/index0.jsp").forward(request, response);
		
		
		//myPagination
		request.getRequestDispatcher("/index1.jsp").forward(request, response);
		
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
